package com.dolphin.business.manager.impl;

import com.dolphin.business.common.utils.PagerModel;
import com.dolphin.business.entity.Order;
import com.dolphin.business.manager.AbstractManager;
import com.dolphin.business.manager.OrderManager;

public class OrderManagerImpl extends AbstractManager implements OrderManager {

	@Override
	public void addOrder(Order order) {

		getHibernateTemplate().save(order);
	}

	@Override
	public void delOrderById(String id) {

		getHibernateTemplate().delete(findOrderById(id));
	}

	@Override
	public PagerModel findAllOrders() {

		return searchPaginate("select o from Order o");
	}

	@Override
	public Order findOrderById(String id) {

		return (Order)getHibernateTemplate().load(Order.class, id);
	}

	@Override
	public void updateOrder(Order order) {

		getHibernateTemplate().update(order);
	}

}
